<template>
	<view class="_p20">
		<el-space wrap>
			<view class="_font">数据源</view>
			<n-com-select memo="请选择数据源" :dictList="dsList" v-model="formData.dsId"></n-com-select>
		</el-space>
		<view>
			
		</view>
		<view class="_abs-cx" style="bottom: 200px;">
			<el-button>取消</el-button>
			<el-button type="primary" @click="save">保存</el-button>
		</view>
	</view>
</template>

<script>
	import ToolVuex from "@/tool/vuex/ToolVuex.js";
	import ToolAction from "@/tool/http/tool-action.js";

	let apiDs = ToolAction.init("data_source");
	export default {
		data() {
			return {
				formData: {
					dsId: undefined
				},
				dsList: []
			}
		},
		mounted() {
			apiDs.dict().then(res => {
				this.dsList = [...res, {
					name: "默认",
					val: null
				}];
			})
		},
		methods: {
			save() {
				ToolVuex.commit("updateDsId", this.formData.dsId);
				this.$store.dispatch("menu/refreshMenu");
				this.$toolUni.toPage("/");
				this.$toolUni.toast("配置成功！");
			}
		}
	}
</script>

<style>
</style>
